5.3 Manage Batch Jobs
Once you’ve created and scheduled a batch job,
you might want to check its status, review its history, or even cancel
it. To verify the status of batch jobs or to cancel them, use the Batch
Job form, which is at Basic\Inquiries\Batch Job.
Batch Job Status
If jobs are in progress, you can view their percentage complete. You can also see whether any jobs are scheduled to start soon.
You can view the status of all batch jobs in
the system or only the jobs that you ordered. You can change the status
of batch jobs by selecting the batch job from the list and then
following these steps:
1. | Click Functions, and then click Change Status.
|
2. | In
the Select New Status dialog box, select the new status for the job.
For example, if the batch job status is Waiting, temporarily remove the
batch job from the waiting list by changing the status to Withhold.
|
Tip
If
an error occurs, restart the job by changing the status to Waiting. If
you want to rerun a job that has ended, change the status from Ended to
Waiting. |
Control Maximum Retries
When an AOS restarts and is configured to run
batch jobs, it immediately attempts to recover from previous runs if it
finds batch tasks in the Executing state. These tasks go back to the
status Ready, and their Actual Retries field, in the Update tab in the
Batch Tasks form, increases by one.
You use Maximum Retries to configure how many
times an AOS can rerun a batch task that has failed because of
infrastructure problems, such as a power outage or a server crash. By
default, this value is set to 1; you can change it in the General tab of
the Batch Tasks form. When the Actual Retries field in the Update tab
exceeds the maximum number of retries, the AOS fails the batch task
instead of attempting to run it again. If this happens, the recurrence
of the batch job is not honored, and the status of the batch job is set
to either Success or Error.
Cancel a Batch Job
You can cancel a batch job by changing its
status to Canceling in the Batch Job form. If the job is currently
executing, the tasks in the Waiting or Ready state are changed to Not
Run, and currently executing tasks are interrupted and their status
changed to Canceled.
Review the Batch Job History
After a batch job has finished running, you can
view its history, including any messages encountered while running the
batch job, in the Batch Job History form, which is in the Dynamics AX
basic module: Inquiries\Batch Job History.
You can also view the logs for each batch job in the Batch Job History form.
To view log information for the whole batch, select a batch job and then click Log.
To
view log information for individual tasks, select a batch job and then
click View Tasks. In the Batch History List form, select a task and
click Log.
Tip
You
can change the batch job settings to log onto the history tables Always
(default), On Error, or Never. Use On Error or Never to save disk space
for batch jobs that are constantly running. This option is in the
General tab of the Batch Job form. |
5.4 Debug a Batch Task
Because server batch tasks run in noninteractive
mode, to debug a server batch task, you have to perform additional
steps to configure your Dynamics AX server and client as well as set up
the usual debug breakpoint steps.
Note
Running in noninteractive
mode means that a user can’t interact directly with a batch task while
it’s running. So you can’t, for example, present a dialog box to gather
user input once a batch task has started executing on a server. |
You first configure the AOS for batch debugging,
and then you configure the Dynamics AX client for batch debugging. For
both tasks, you use the Server Configuration Utility, which you access
through All Programs\Administrative Tools\Microsoft Dynamics AX Server
Configuration. For configuration specifics, consult the Microsoft
Dynamics AX 2009 SDK, available on MSDN.
Configure the AOS for Batch Debugging
You can use the Dynamics AX Server
Configuration Utility to configure the AOS for batch debugging. The
utility is available on the machine where you installed your AOS, from
All Programs\Administrative Tools\Microsoft Dynamics AX 2009 Server
Configuration.
1. | In the Server Configuration Utility, select the check boxes for the following:
|
2. | Click OK to close the utility, and then restart the AOS.
|
Figure 7 shows the Dynamics AX 2009 Server Configuration Utility.
Configure the Client for Batch Debugging
To
configure the client for batch debugging, you use the Microsoft
Dynamics AX 2009 Configuration Utility. (This utility is different than
the Server Configuration Utility.) Figure 8 shows the Microsoft Dynamics AX Configuration Utility.
The Configuration Utility is available from All
Programs\Administrative Tools\Microsoft Dynamics AX 2009\Configuration.
(The line might not specify server versus client.)
1. | In
the Configuration Utility, select the check box for Enable Global
Breakpoints To Debug Code Running In The Business Connector Or Client.
|
2. | Click OK to close the utility.
|
Run AxDebug.exe on the Client Computer
In
Windows Explorer, locate the Client\Bin\Directory of your Dynamics AX
installation. Double-click the AxDebug.exe program to run it. Now you’re
ready to debug batch jobs running on the server.